<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../common/vue.min.js" type="text/javascript"></script>
</head>
<body>
<!--view-->
<div id="e2">
    <p v-if="greeting">helllloword!!</p>
</div>

<script type="text/javascript">

    /**
     *
     */
    var vm = new Vue({
        el: '#e2', //el :element
        data: {
            greeting:false
        }
    })

    console.log(vm.$el);
    console.log(vm.$data.greeting);

    // $watch 是一个实例方法
    vm.$watch("greeting",function(newVal,oldVal){
        // 这个回调将在 `greeting`值  改变后调用
        alert("newVal:"+newVal+", oldVal:"+oldVal)

    })


</script>

</body>
</html>